package com.atguigu.gmall.pay.controller;

import com.alipay.api.AlipayApiException;
import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.pay.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lfy
 * @Description 处理支付宝支付
 * @create 2022-10-22 14:18
 */
@RestController
@RequestMapping("/api/payment/alipay")
public class AliPaymentController {


    @Autowired
    PayService payService;

    /**
     * 展示支付收银台页面
     * @return
     */
    @GetMapping(value = "/submit/{orderId}",produces = MediaType.TEXT_HTML_VALUE)
    public String payShouyinPage(@PathVariable("orderId")Long orderId) throws AlipayApiException {

        //展示支付收银台页面
        String html =  payService.generateOrderPayPage(orderId);

        return html;
    }

}
